unit Unit6; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
  Buttons, Unit1;

type

  { TForm6 }

  TForm6 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormShow;
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  Form6: TForm6; 

implementation

{ TForm6 }

procedure TForm6.FormShow;
begin
  Edit1.Text := '';
  Edit2.Text := '';
  
  Edit1.SetFocus;
end;

procedure TForm6.Button1Click(Sender: TObject);
var
  QueryString : String;
  
begin
  if Edit1.Text <> '' then
  begin
    QueryString := 'insert into fabricante(fab_nombre, fab_descripcion) values(''' + Edit1.Text
      + ''', ''' + Edit2.Text + ''')';

    Form1.PQConnection1.ExecuteDirect('begin work;');
    Form1.PQConnection1.ExecuteDirect(QueryString);
    Form1.PQConnection1.ExecuteDirect('commit work;');
    
    ShowMessage('ALTA DE FABRICANTE EXITOSA');

    FormShow;
  end
  else
    ShowMessage('ERROR EN EL INGRESO DE DATOS');
end;

procedure TForm6.Button2Click(Sender: TObject);
begin
  Close;
end;

initialization
  {$I unit6.lrs}

end.

